<template>
  <tr>
    <td>
      <input type="checkbox" v-model="arr.checked" />
    </td>
    <td>{{arr.name}}</td>
    <td>{{arr.price}}</td>
    <td>
      <button @click="btnjia(idx)">+</button>
      {{arr.num}}
      <button @click="btnjian(idx)">-</button>
    </td>
    <td>{{num}}</td>
    <td>
      <button @click="del(idx)">删除</button>
    </td>
  </tr>
</template>

<script>
export default {
  name: "gwc",
  props: ["arr", "idx"],
  methods: {
    btnjia(index) {
      this.$emit("btnjia", index);
    },
    btnjian(index) {
      this.$emit("btnjian", index);
    },
    del(index) {
      this.$emit("del", index);
    },
  },
  computed: {
    num() {
      return this.arr.num * this.arr.price;
    },
  },
};
</script>

<style>
</style>